<template>
  <div class="my">
    <van-sticky>
      <van-nav-bar>
        <h4 slot="title">我的</h4>
      </van-nav-bar>
    </van-sticky>
    <div class="user">
      <van-image round src="https://img.yzcdn.cn/vant/cat.jpeg" />
      <span>点击登录</span>
    </div>
    <van-grid :column-num="3">
      <van-grid-item v-for="(item,index) in data" :key="index" :icon="item.icon" :text="item.text" />
    </van-grid>
    
  </div>
</template>
<script>
export default {
  name: "My",
  data() {
    return {
      data: [
        {
          text: "我的订单",
          icon: "balance-list-o"
        },
        {
          text: "优惠券",
          icon: "gold-coin-o"
        },
        {
          text: "礼品卡",
          icon: "vip-card-o"
        },
        {
          text: "我的收藏",
          icon: "bulb-o"
        },
        {
          text: "我的足迹",
          icon: "aim"
        },
        {
          text: "账号安全",
          icon: "pending-payment"
        },
        {
          text: "联系客服",
          icon: "user-circle-o"
        }
      ],
      msg:3
    };
  },
  methods: {
    async adduser() {
      var result = await this.$http.get("adduser", {
        params: { name: "jjj", age: 16, parent_id: 2 }
      });
      console.log("添加成功");
    },
    async deleteuser() {
      var result = await this.$http.get("deleteuser/1");
      console.log("删除成功");
    },
    async updateuser() {
      var result = await this.$http.get("updateuser/3", {
        params: {
          name: "歇两天",
          age: 200,
          parent_id: 200
        }
      });
      console.log("修改成功");
    },
    async queryuser() {
      var result = await this.$http.get(`queryuser/2`);
      console.log(result);
    },
    async queryall() {
      var result = await this.$http.get(`queryall`);
      console.log(result);
    },
    async clearall() {
      var result = await this.$http.get(`clearall`);
      console.log('删除成功');
    },
  },
  components: {}
};
</script>
<style lang="less" scoped>
.my {
  margin-bottom: 50px;
}
.van-nav-bar {
  height: 40px;
  h4 {
    margin: 0;
    height: 40px;
  }
}
.user {
  display: flex;
  padding: 50px 10px;
  background-color: tomato;
  > .van-image {
    width: 70px;
    height: 70px;
  }
  > span {
    line-height: 70px;
    color: white;
    padding: 0 10px;
  }
}
</style>
